﻿package com.tudou.ad.components
{
    import com.tudou.ad.events.*;
    import com.tudou.skin.*;
    import com.tudou.skin.common.button.*;
    import com.tudou.skin.common.events.*;
    import com.tudou.utils.*;
    import flash.display.*;
    import flash.events.*;

    public class AdPauseVideoControlPanel extends AdVideoControlPanelBase
    {
        private var getMore:InteractiveObject;

        public function AdPauseVideoControlPanel()
        {
            adVolume = new BaseButton();
            adVolume.y = 3;
            adVolume.addStateButton(new VolumeIconMC());
            adVolume.addStateButton(new VolumeIconNoneMC());
            addChild(adVolume);
            getMore = new GetMorePauseBTN();
            addChild(getMore);
            adVolume.activeIndex = 0;
            adVolume.clickContainer = true;
            getMore.addEventListener(MouseEvent.CLICK, mouseClickHlr);
            adVolume.addEventListener(ButtonEvent.CLICK, volumeHlr);
            return;
        }// end function

        private function mouseClickHlr(event:MouseEvent) : void
        {
            dispatchEvent(new AdVideoControlPanelEvent(AdVideoControlPanelEvent.FLOAT_CLICK));
            return;
        }// end function

        override public function set width(param1:Number) : void
        {
            RectDisplayUtil.drawRect(graphics, param1, 20, 0, 0);
            adVolume.x = 3;
            getMore.x = int(param1 - getMore.width);
            return;
        }// end function

        override public function clear() : void
        {
            if (adVolume)
            {
                adVolume.removeEventListener(ButtonEvent.CLICK, volumeHlr);
            }
            if (getMore)
            {
                getMore.removeEventListener(MouseEvent.CLICK, mouseClickHlr);
            }
            while (this.numChildren > 0)
            {
                
                this.removeChildAt(0);
            }
            timeTip = null;
            adVolume = null;
            getMore = null;
            return;
        }// end function

    }
}
